//
//  SixinTableViewCell.m
//  XRSquare
//
//  Created by UaenaMo on 2018/8/15.
//  Copyright © 2018年 UaenaMo. All rights reserved.
//

#import "SixinTableViewCell.h"

@interface SixinTableViewCell ()
{
    UIImageView * imagev;
    UILabel * titleLabel;
    UILabel * timeLabel;
    UILabel * lastContent;
}
@end

@implementation SixinTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        imagev = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 40, 40)];
        imagev.contentMode = UIViewContentModeScaleAspectFill;
        imagev.clipsToBounds = YES;
        [self addSubview:imagev];
        
        titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(60, 10, ScreenWidth - 60, 20)];
        titleLabel.font = [UIFont boldSystemFontOfSize:15];
        [self addSubview:titleLabel];
        
        timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(60, 10, ScreenWidth - 70, 20)];
        timeLabel.font = [UIFont systemFontOfSize:12];
        timeLabel.textAlignment = NSTextAlignmentRight;
        timeLabel.textColor = [UIColor colorFromHexCode:@"b3b3b3"];
        [self addSubview:timeLabel];
        
        lastContent = [[UILabel alloc]initWithFrame:CGRectMake(60, 30, ScreenWidth - 70, 20)];
        lastContent.font = [UIFont systemFontOfSize:15];
        lastContent.textColor = [UIColor colorFromHexCode:@"b3b3b3"];
        [self addSubview:lastContent];
        
        UIView * line = [[UIView alloc]initWithFrame:CGRectMake(0, 59, ScreenWidth, 1)];
        line.backgroundColor = [UIColor colorFromHexCode:@"f3f3f3"];
        [self addSubview:line];
    }
    return self;
}

+(CGFloat)height
{
    return 60;
}

-(void)loadData:(NSDictionary *)data
{
    [imagev sd_setImageWithURL:[NSURL URLWithString:[data objectForKey:@"TalkToUserPic"]]];
    titleLabel.text = [data objectForKey:@"TalkToUserName"];
    timeLabel.text = [data objectForKey:@"Time"];
    lastContent.text = [data objectForKey:@"Content"];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
